home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 9 / Night Owl CD-ROM (NOPV9) (Night Owl Publisher) (1993).ISO / 050a / tsemac.zip / PARA.S < prev    next >
Text File  |  1993-04-12  |  2KB  |  70 lines

  1. /************************************************************************
  2.   Author:  SemWare (Richard Blackburn)
  3.   Date:    April 8, 1993
  4.  
  5.   Description:
  6.  
  7.   A couple of macros to go to the next and previous paragraphs.
  8.   Assumes paragraphs are separated by blank lines.
  9.  
  10.   Usage notes:
  11.  
  12.   To use, add these macros to your TSE.S file, and key assignments to
  13.   your TSE.KEY file, and re-bind the editor using the -b switch of sc.
  14.  
  15.   Example key assignments might be:
  16.  
  17.   <f7>          NextPara()
  18.   <f8>          PrevPara()
  19.  
  20.   Alternatively, add the key assignments to this file, and load the
  21.   macro (as an external macro) as needed via the LoadMacro command
  22.   (<ctrl f10><L> or 'menu->macro->load')
  23.  ************************************************************************/
  24.  
  25. // Go to the start of the next Paragraph.
  26. proc NextPara()
  27.     // if in a paragraph, scan till the end of it
  28.     while PosFirstNonWhite()
  29.         if not Down()
  30.             goto common_exit
  31.         endif
  32.     endwhile
  33.  
  34.     // skip any blank lines
  35.     while PosFirstNonWhite() == 0
  36.         if not Down()
  37.             goto common_exit
  38.         endif
  39.     endwhile
  40.  
  41.     common_exit:
  42.     GotoPos(PosFirstNonWhite())
  43. end
  44.  
  45. // If in a para (and not on the first line) go to the beginning of the para.
  46. // Otherwise, go to the beginning of the previous para.
  47. proc PrevPara()
  48.     if not Up()
  49.         goto common_exit
  50.     endif
  51.  
  52.     while PosFirstNonWhite() == 0
  53.         if not Up()
  54.             goto common_exit
  55.         endif
  56.     endwhile
  57.  
  58.     while PosFirstNonWhite()
  59.         if not Up()
  60.             goto common_exit
  61.         endif
  62.     endwhile
  63.  
  64.     Down()
  65.  
  66.     common_exit:
  67.     GotoPos(PosFirstNonWhite())
  68. end
  69.  
  70.